package com.shujia.controller;

import com.shujia.entity.Dept;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;

@Controller
public class HTMLController {
    @RequestMapping("html")
    public String toHtml() {
        return "index";
    }

    @RequestMapping("html2")
    public String toHtml2(Model model) {
        ArrayList<Dept> depts = new ArrayList<>();
        depts.add(new Dept("1001", "数加", "安徽合肥"));
        depts.add(new Dept("1002", "数加2", "安徽合肥2"));
        depts.add(new Dept("1003", "数加3", "安徽合肥3"));

        model.addAttribute("depts", depts);
        model.addAttribute("name", "张三");
        model.addAttribute("name2", "<a href='html'>百度链接</a>");
        return "index2";
    }
}
